home *** CD-ROM | disk | FTP | other *** search
- This patch to cfront Version 1.2 came from the Et++ distribution. I
- have found it useful for clearing up some of the more notorious cfront
- bugs.
-
- diff -c src.orig/cfront.h src/cfront.h
- *** src.orig/cfront.h Sat Apr 22 02:11:11 1989
- --- src/cfront.h Sat Apr 22 02:09:29 1989
- ***************
- *** 100,105 ****
- --- 100,106 ----
- extern int error_count;
- extern bit debug;
- extern int vtbl_opt;
- + extern int vtbl_opt2;
- extern FILE* out_file;
- extern FILE* in_file;
- extern char scan_started;
- diff -c src.orig/expand.c src/expand.c
- *** src.orig/expand.c Sat Apr 22 02:11:11 1989
- --- src/expand.c Sat Apr 22 02:09:30 1989
- ***************
- *** 149,154 ****
- --- 149,155 ----
- }
-
- if (expand_tbl) { /* make expression */
- + extern int functiondefinedinclass;
- Pexpr ee;
- static ret_seen = 0;
-
- ***************
- *** 159,165 ****
- for (n = tbl->get_mem(i=1); n; n=tbl->get_mem(++i)) {
- if (n->base!=NAME || n->tp==any_type) continue;
- if ( base == BLOCK &&
- ! n->lex_level<((Pfct(expand_fn->tp)->memof)?3:2))
- continue;
- Pname nn = dcl_local(scope,n,expand_fn);
- nn->base = NAME;
- --- 160,166 ----
- for (n = tbl->get_mem(i=1); n; n=tbl->get_mem(++i)) {
- if (n->base!=NAME || n->tp==any_type) continue;
- if ( base == BLOCK &&
- ! ((n->lex_level < functiondefinedinclass) ? 3 : 2))
- continue;
- Pname nn = dcl_local(scope,n,expand_fn);
- nn->base = NAME;
- diff -c src.orig/lex.c src/lex.c
- *** src.orig/lex.c Sat Apr 22 02:11:12 1989
- --- src/lex.c Sat Apr 22 02:09:31 1989
- ***************
- *** 487,500 ****
- --- 487,530 ----
- }
- }
-
- + char nextclassvtbl[40][40];
-
- void linecom()
- // process a "line comment"
- {
- register c;
- + static int ncvcnt= 0;
-
- for(;;)
- switch (get(c)) {
- + case '$':
- + int i;
- + if (!vtbl_opt2)
- + break;
- + restart:
- + i= 0;
- + for(;;)
- + switch(get(c)) {
- + case ',':
- + nextclassvtbl[ncvcnt++][i]= 0;
- + goto restart;
- + case '\n':
- + curloc.line++;
- + Nline++;
- + saved = lxtitle();
- + case '$':
- + goto out;
- + case EOF:
- + error("eof in comment");
- + return;
- + default:
- + nextclassvtbl[ncvcnt][i++]= c;
- + case ' ':
- + break;
- + }
- + out: nextclassvtbl[ncvcnt++][i]= 0;
- + nextclassvtbl[ncvcnt][0]= 0;
- + break;
- case EOF:
- error("eof in comment");
- return;
- diff -c src.orig/main.c src/main.c
- *** src.orig/main.c Sat Apr 22 02:11:12 1989
- --- src/main.c Sat Apr 22 02:09:32 1989
- ***************
- *** 69,74 ****
- --- 69,75 ----
- // 0 external and supposed to be defined elsewhere
- // 1 external and defined
-
- + int vtbl_opt2= 0;
- simpl_init();
- typ_init();
- syn_init();
- ***************
- *** 89,95 ****
- fprintf(stderr,"start time: %s", ctime(&start_time) );
- fprintf(stderr,"stop time: %s", ctime(&stop_time) );
- fprintf(stderr,"real time delay %ld: %d lines per second\n",
- ! stop_time-start_time, Nline/(stop_time-start_time) );
- fflush(stderr);
- }
- print_free();
- --- 90,98 ----
- fprintf(stderr,"start time: %s", ctime(&start_time) );
- fprintf(stderr,"stop time: %s", ctime(&stop_time) );
- fprintf(stderr,"real time delay %ld: %d lines per second\n",
- ! stop_time-start_time,
- ! stop_time-start_time > 0 ? Nline/(stop_time-start_time)
- ! : Nline);
- fflush(stderr);
- }
- print_free();
- ***************
- *** 403,408 ****
- --- 406,414 ----
- case '0':
- case '1':
- vtbl_opt = *cp-'0';
- + break;
- + case '2':
- + vtbl_opt2= 1;
- break;
- default:
- fprintf(stderr,"bad +e option");
- diff -c src.orig/norm.c src/norm.c
- *** src.orig/norm.c Sat Apr 22 02:11:12 1989
- --- src/norm.c Sat Apr 22 02:09:33 1989
- ***************
- *** 1174,1179 ****
- --- 1174,1181 ----
- bit v = 0;
- register Ptype t = this;
-
- + if (t == 0)
- + return 0;
- eobj = 0;
- cl_obj_vec = 0;
- xx:
- diff -c src.orig/print.c src/print.c
- *** src.orig/print.c Sat Apr 22 02:11:13 1989
- --- src/print.c Sat Apr 22 02:43:50 1989
- ***************
- *** 964,969 ****
- --- 964,971 ----
-
- void classdef::dcl_print(Pname)
- {
- + extern char nextclassvtbl[40][40];
- + int vo;
- Plist l;
- TOK c = csu==CLASS ? STRUCT : csu;
-
- ***************
- *** 1025,1032 ****
- }
- }
- }
- !
- ! switch (vtbl_opt) {
- case -1:
- putstring("static ");
- case 1:
- --- 1027,1043 ----
- }
- }
- }
- ! if (vtbl_opt2) {
- ! int ii;
- ! vo= 0;
- ! for (ii= 0; nextclassvtbl[ii][0]; ii++)
- ! if (strcmp(string, nextclassvtbl[ii]) == 0) {
- ! vo= 1;
- ! break;
- ! }
- ! } else
- ! vo= vtbl_opt;
- ! switch (vo) {
- case -1:
- putstring("static ");
- case 1:
- diff -c src.orig/simpl.c src/simpl.c
- *** src.orig/simpl.c Sat Apr 22 02:11:13 1989
- --- src/simpl.c Sat Apr 22 02:09:35 1989
- ***************
- *** 920,925 ****
- --- 920,926 ----
- return stail;
- }
-
- + int functiondefinedinclass= 0;
-
- void classdef::simpl()
- {
- ***************
- *** 928,933 ****
- --- 929,935 ----
- Pclass oc = in_class;
-
- in_class = this;
- + functiondefinedinclass++;
- for (m=memtbl->get_mem(i=1); m; m=memtbl->get_mem(++i) ) {
- Pexpr i = m->n_initializer;
- m->n_initializer = 0;
- ***************
- *** 934,939 ****
- --- 936,942 ----
- m->simpl();
- m->n_initializer = i;
- }
- + functiondefinedinclass--;
- in_class = oc;
-
- for (Plist fl=friend_list; fl; fl=fl->l) { /* simplify friends */
- ***************
- *** 1141,1147 ****
- e1->tp = q->tp->deref();
- }
- else { // may be virtual: yuk
- ! Pfct f = Pfct(Pptr(q->tp)->typ);
- if (f->f_this == 0) {
- if (f->memof == 0) error('i',"memof missing");
- Pname tt = new name("this");
- --- 1144,1153 ----
- e1->tp = q->tp->deref();
- }
- else { // may be virtual: yuk
- ! Ptype pt = q->tp;
- ! while (pt->base == TYPE)
- ! pt= Pbase(pt)->b_name->tp;
- ! Pfct f = Pfct(Pptr(pt)->typ);
- if (f->f_this == 0) {
- if (f->memof == 0) error('i',"memof missing");
- Pname tt = new name("this");
- diff -c src.orig/size.h src/size.h
- *** src.orig/size.h Sat Apr 22 02:11:13 1989
- --- src/size.h Sat Apr 22 02:09:36 1989
- ***************
- *** 120,126 ****
- #define DF_SENSITIVE 0
- #define DF_OPTIMIZED 1
- #else
- ! #if sun | mc68k
- /* most M68K boxes */
- #define DBI_IN_WORD 32
- #define DBI_IN_BYTE 8
- --- 120,126 ----
- #define DF_SENSITIVE 0
- #define DF_OPTIMIZED 1
- #else
- ! #if sun | mc68k | m68k
- /* most M68K boxes */
- #define DBI_IN_WORD 32
- #define DBI_IN_BYTE 8
- ***************
- *** 182,188 ****
- #define DF_SENSITIVE 0
- #define DF_OPTIMIZED 1
- #else
- ! #if uts
- /* Amdahl running UTS */
- #define DBI_IN_WORD 32
- #define DBI_IN_BYTE 8
- --- 182,188 ----
- #define DF_SENSITIVE 0
- #define DF_OPTIMIZED 1
- #else
- ! #if uts || mips
- /* Amdahl running UTS */
- #define DBI_IN_WORD 32
- #define DBI_IN_BYTE 8
-